import {NgModule, Provider} from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {provideAnimationsAsync} from "@angular/platform-browser/animations/async";
import {providePrimeNG} from "primeng/config";
import Aura from '@primeng/themes/aura';
import Lara from '@primeng/themes/lara';
import {ButtonModule} from "primeng/button";
import {CardModule} from "primeng/card";
import {MenubarModule} from "primeng/menubar";
import {InputGroup, InputGroupModule} from "primeng/inputgroup";
import {InputTextModule} from "primeng/inputtext";
import {FluidModule} from "primeng/fluid";
import {IonicStorageModule} from "@ionic/storage-angular";
import { Drivers, Storage } from '@ionic/storage';
import {HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi} from "@angular/common/http";
import {MyHttpInterceptor} from "./services/MyHttpInterceptor";
import { P401Component } from './components/p401/p401.component';
import { P403Component } from './components/p403/p403.component';
import { LoginComponent } from './components/login/login.component';
import {PasswordModule} from "primeng/password";
import {MessageModule} from "primeng/message";
import {MessageService} from "primeng/api";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {MessagesModule} from "primeng/messages";

export const noopInterceptorProvider: Provider =
  { provide: HTTP_INTERCEPTORS, useClass: MyHttpInterceptor, multi: true };


@NgModule({
  declarations: [
    AppComponent,
    P401Component,
    P403Component,
    LoginComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    ButtonModule,
    CardModule,
    MenubarModule,
    InputGroupModule,
    PasswordModule,
    InputTextModule,
    ReactiveFormsModule,
    FormsModule,
    IonicStorageModule.forRoot({
      name: 'prime_demo',
      driverOrder: [Drivers.LocalStorage]
    }),
    MessagesModule,


  ],
  providers: [provideAnimationsAsync(),
    providePrimeNG({
      theme: {
        preset: Aura,
        // preset: Lara,
        options: {
          cssLayer: {
            name: 'primeng',
            order: 'tailwind-base, primeng, tailwind-utilities'
          },
          darkModeSelector: false || 'none'

        },
      },

    }),

    provideHttpClient(
      withInterceptorsFromDi(),
    ),

    { provide: HTTP_INTERCEPTORS, useClass: MyHttpInterceptor, multi: true},
    MessageService
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
